<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>文字跑马灯</title>
	<style>
		*{padding:0;margin:0;}
		#pid{
			margin-left:30px;
			margin-top:30px;
			font-size:36px;
		}
	</style>
</head>
<body>
	<font id="show" size="6" ></font>
</body>
	<script>
		var str = "JavaScript";

		function demo(i,str){
			tmp = str.substring(0,i);
			tmp += '<font color="red" size="7" >'+str[i]+'</font>';
			tmp += str.substr(i+1);
			return tmp;
		}
		i=0;
		setInterval(function(){
			if(i>=str.length){
				i=0;
			}
			document.getElementById("show").innerHTML = demo(i,str);
			i++;
		},100);


	</script>
</html>